const header = document.querySelector('.header')
window.addEventListener('scroll',()=>{
    if(scrollY>300){
        header.classList.add('active')
    }else{
        header.classList.remove('active')
    }
})



const items=document.querySelectorAll("[data-reveal]")

function revealCB(){
    items.forEach((item)=>{
        if(item.getBoundingClientRect().top<window.innerHeight-100){
            item.classList.add('revealed')
        }
        //自己加的
        if(item.getBoundingClientRect().top>window.innerHeight-100){
            item.classList.remove('revealed')
        }
    })
}
window.addEventListener('load',revealCB)
window.addEventListener('scroll',revealCB)